import asyncio


loop = asyncio.get_event_loop()

# 同步回调 synchronous callbacks on the event loop.
loop.call_soon(print,"循环中排程")
loop.call_soon_threadsafe(print,"循环中排程,线程安全")
loop.call_later(1,print,"循环中1秒后排程")
loop.call_soon(print,"这句先于 ‘循环中1秒后排程’ 出现")
loop.call_at(loop.time()+1,print,"循环中也是1秒后排程")
try:
    loop.run_forever()
except KeyboardInterrupt as e:
    loop.stop()
finally:
    loop.close()
